#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
#define rep(i,b) for(int i=0; i<(b); i++)
#define foreach(i,a) for(__typeof((a).begin()) i=a.begin(); i!=(a).end(); ++i)

class Point {
public:
	int x, y;
	double v;
	Point(int a = 0, int b = 0, double v = 0) :x(a), y(b), v(v) {}
	bool isin(int d1, int d2) {
		return x <= d1 && y >= d2;
	}
};

void fun(string sin) {
	istringstream in(sin);
	string addr;
	in >> addr;

	set<int> d;
	vector<Point> p;

	// read data
	int x, y;
	double v;
	while (in >> x >> y >> v) {
		d.insert(x); d.insert(y);
		p.push_back(Point(x, y, v));
	}

	// output
	cout.precision(17);

	int logo = 0, logo2 = 0;
	double sum = 0, lastval = 0;
	int n = *(d.begin());
	if (n > 42309) {
	    d.erase(d.begin());
	    d.insert(n - 1);
	    d.insert(42309);
	}
	n = *(d.rbegin());
	if (n < 42794) {
	    logo2 = 1;
	    d.insert(42794);
	}
	foreach(it, d) {
		set<int>::iterator it2 = it; ++it2;
		int d1 = (*it) + logo, d2 = *it2;
		cout << addr << "\t" << d1 << "\t" << d2 << "\t";
        logo = 1;

        lastval = sum;
		sum = 0;
		rep(i, p.size()) {
			if (p[i].isin(d1, d2)) {
				sum += p[i].v;
			}
		}
		
		++it2;
		if (it2 == d.end() && logo2) {
		    cout << fixed << lastval << "\n";
		    break;
		}
		else {
		    cout << fixed << sum << "\t" << "\n";
		    if (it2 == d.end()) break;
		}
	}
}

int main() {
	//freopen("in.txt", "r", stdin);

	string line;
	while (getline(cin, line)) {
		fun(line);
	}

	return 0;
}
